public class Powerizer {
    public static void main(String[] args) {
        int power = 11;
        int number = 2;
        System.out.println(number + "^" + power + " = " + power(number, power));
    }

    private static int power(int number, int power) {
        if (power < 0) {
            throw new IllegalArgumentException("The power must be non-negative number");
        }
        if (power == 0) {
            return 1;
        }
        if (power == 1) {
            return number;
        }
        if (power % 2 == 0) {
            return power(number, power / 2) * power(number, power / 2);
        } else {
            return number * power(number, power - 1);
        }
    }
}
